package axonactive.vision.training.dao;

import axonactive.vision.training.entity.User;
import ch.ivyteam.ivy.environment.Ivy;
import ch.ivyteam.ivy.process.data.persistence.IIvyEntityManager;

public class UserDAO {
	private IIvyEntityManager entityManager;
	
	public UserDAO(){
		entityManager = Ivy.persistence().get("IvyTraining");
	}
	
	public User getUserByCode(String code){
		return (User) entityManager.createQuery("from User where code like :code")
					.setParameter("code", code+"%")
					.getSingleResult();
	}
}
